package com.bwie.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bwie.mapper.DictMapper;
import com.bwie.pojo.Borrow;
import com.bwie.pojo.Dict;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.mapper.BorrowMapper;
import com.bwie.service.BorrowService;

import java.util.List;

@Service
public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> implements BorrowService{

    @Autowired
    BorrowMapper borrowMapper;
    @Autowired
    DictMapper dictMapper;
    @Override
    public R getBorrowList(PageInfoVo pageInfoVo) {
        Page<Borrow> page = new Page<>(pageInfoVo.getPageNum(),pageInfoVo.getPageSize());
        Page<Borrow> borrowPage = borrowMapper.selectPage(page, null);
        return R.OK(borrowPage);
    }

    @Override
    public R dictType() {
        List<Dict> dictList = dictMapper.selectList(null);
        return R.OK(dictList);
    }
}
